import gradio as gr
from zhipuai import ZhipuAI

client = ZhipuAI(api_key="*********")

def greet(prompt):
    response = client.images.generations(
    model="cogview-4-250304", 
    prompt=prompt,
)
    return response.data[0].url

demo = gr.Interface(
    fn=greet,
    inputs=["textarea"],
    outputs=["image"],
)

demo.launch()
